/**
 * related to addShop1.ui
 * 
 * @Author : chenglm
 * @Timestamp : 2016-12-17
 */
var app = sm("do_App");
var page = sm("do_Page");
var openHelper = require("helper/open");
var urlMall = require("url/mall");
var qqHttp = require("helper/http");
var userUtil = require("helper/user");
var nf = sm("do_Notification");

//andriod返回键
page.on("back", function() {
    app.closePage();
});

/* 头部 */
var headerAout = ui("layoutHead");
var addheader = headerAout.add("header", "source://view/reuse/header.ui", 0, 0);
//左上角-返回
var headerLeft = ui(addheader+".headerLeft");
var labelTitle = ui(addheader+".labelTitle");
labelTitle.text = '我的店铺';
headerLeft.on("touch", function() {
    app.closePage();
});

var buttonCreate = ui("button_create");
buttonCreate.on("touch", function(data, e) {
	qqHttp.post(urlMall.url.shop.beforeCreate, {}, function(data) {
		if (data.hasCreate == 1) {
			openHelper.open("source://view/qshop/manage/shop/myShop.ui");
		} else {
			if (data.auditStatus == 0 || data.auditStatus == 3) {
				nf.toast(data.msg);
				openHelper.open("source://view/user/auth/edit.ui",{"fromPage":"addShop"});
			} else {
				openHelper.open("source://view/qshop/manage/shop/addShop2.ui");
			}
		}
	});
});